<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'viewget_people.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<link rel="stylesheet" type="text/css" href="<%=basePath%>pages/news/first_page/style/backstage.css" media="all" />
		<script type="text/javascript" charset="utf-8"
			src="<%=basePath%>/pages/news/js/jquery-1.5.1.min.js"></script>
		<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	</head>

	<body>
		<fieldset class="fieldset">
		<legend class="legend">新建用户：</legend>
		<form action="<%=basePath%>login_user/add_people" method="post" id="sumbit" class="form">
			管理员登录名：&nbsp;&nbsp;&nbsp;
			<input type="text" name="newsPeople.name" id="peoplename"
				onkeyup="value = value.replace(/[^\w\.\/]/ig, '');"><span id="booblean" class="false"></span><br />
			管理员密码：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="password" name="newsPeople.psw"
				onkeyup="value = value.replace(/[^\w\.\/]/ig, '');"><span id="boobleanpsw" class="false"></span><br />
			重复管理员密码：
			<input type="password" name="psw"
				onkeyup="value = value.replace(/[^\w\.\/]/ig, '');"><span id="boobleanpswagin" class="false"></span><br /> 
			管理员类型:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<select name="newsPeople.popleType">
				<option value="1">
					高级管理员
				</option>
				<option value="2">
					一般管理员
				</option>
			</select><br />
			E-mail:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
			<input type="text" name="newsPeople.email"><br />
            <input name="" type="button" onClick="fromsumbit()" value="确定" class="button">
		</form>
		</fieldset>
		<script type="text/javascript">
	$(document).ready(function() {
		$('input[name="newsPeople.name"]').blur(function() {
			$('#booblean').text('');
			if($('input[name="newsPeople.name"]').val().length<7){
				$('#booblean').text('输入错误，请输入！');
				$('#booblean').addClass('false');
			}else{
				$.post('${contextPath}/login_user/boolean_news_people/', {
					'newsPeople.name' : this.value
				}, function(josn) {
					if (josn == 'false') {
						$('#booblean').text('已有帐号！');
						$('#booblean').addClass('false');
					}else{
						$('#booblean').text('可用有帐号！');
						$('#booblean').removeClass('false');
					}
				});
			}
		})
		$(':password[name="newsPeople.psw"]').blur(function() {
			if($(':password[name="newsPeople.psw"]').val().length<7){
				$('#boobleanpsw').text('输入错误，请输入！');
				$('#boobleanpsw').addClass('false');
			}else{
				$('#boobleanpsw').text('');
				$('#boobleanpsw').removeClass('false');
			}
		})
		$(':password[name="psw"]').blur(function() {
			if($(':password[name="psw"]').val().length<7){
				$('#boobleanpswagin').text('输入错误，请输入！');
				$('#boobleanpswagin').addClass('false');
			}else if($(':password[name="psw"]').val()!=$(':password[name="newsPeople.psw"]').val()){
				$('#boobleanpswagin').text('密码不同！');
				$('#boobleanpswagin').addClass('false');
			}else{
				$('#boobleanpswagin').text('');
				$('#boobleanpswagin').removeClass('false');
			}
		})
	});
	function fromsumbit(){
		if($('#boobleanpswagin').hasClass('false')){
			$('#boobleanpswagin').text('错误！');
		}if($('#boobleanpsw').hasClass('false')){
			$('#boobleanpsw').text('错误！');
		}if($('#booblean').hasClass('false')){
			$('#booblean').text('错误！');
		}else if(!$('#booblean').hasClass('false')&&!$('#boobleanpsw').hasClass('false')&&!$('#boobleanpswagin').hasClass('false')){
			$('#sumbit').submit();
		}
	}
</script>
	</body>
</html>
